﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Jarvis.Learners 
{
    [Serializable()]
    class Example : ISerializable
    {
        public String label;
        public Dictionary<string, object> state;
        public Dictionary<string, double> splits;
        public Dictionary<string, object> subitems;

        public Example(String label, Dictionary<String, Object> state)
        {
            this.label = label;
            this.state = state;

            this.splits = new Dictionary<string, double>();
            this.subitems = new Dictionary<string, object>();
        }

        public Example(SerializationInfo info, StreamingContext ctxt)
        {
            this.label = (String) info.GetValue("Label", typeof(String));
            this.state = (Dictionary<string, object>)info.GetValue("State", typeof(Dictionary<string, object>));

            this.splits = new Dictionary<string, double>();
            this.subitems = new Dictionary<string, object>();
        }
        
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("Label", this.label);
            info.AddValue("State", this.state);
        }
    }
}
